# _*_ coding:utf-8 _*_
# @Time : 2023/6/12 11:39
# @Author : wsl
# @File : chrome4_handless
# @Project : python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options


def share_browser():
    chrome_options = Options()
    chrome_options.add_argument('‐‐headless')
    chrome_options.add_argument('‐‐disable‐gpu')
    path = r'C:\Program Files\Google\Chrome\Application\chrome.exe'
    chrome_options.binary_location = path
    browser = webdriver.Chrome(chrome_options=chrome_options)
    return browser


browser = share_browser()
browser.get('http://www.baidu.com/')
browser.save_screenshot('baidu.png')
